package com.apes.pi.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.plugin.enumeration.EnumValue;
import com.apes.framework.plugin.enumeration.EnumType;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @author wuq
 * @create 2020-02-05 11:59
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = TestEnumModel.CONST_TABLE_NAME)
public class TestEnumModel {
    public static final String CONST_TABLE_NAME = "Pi_Test_Enum";

    @Id
    @Column(name = "ID", nullable = false, length = 32)
    private String id;

    @EnumType(id = "test", name ="程序测试", sys_inner = false,
            values = {
                    @EnumValue(id="test_1", name="测试1", code="测试1"),
                    @EnumValue(id="test_2", name="测试2", code="测试2")
            })
    private String testEnum;

}
